/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.csvgenerator.engine.vc;

import com.csvgenerator.engine.value.ValueProducer;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class ConcatenatorValueCombinator extends ValueCombinator {

    private List<ValueProducer> producerReferences = new ArrayList<ValueProducer>();
    private String prefix = "";
    private String infix = "";
    private String suffix = "";

    @Override
    public String nextValue() {
        String nextValue = prefix;
        for (ValueProducer vp : producerReferences) {
            
            nextValue += vp.getCurrentValue();
            if (producerReferences.indexOf(vp)!=producerReferences.size()-1) {
                nextValue += infix;
            }
        }
        nextValue += suffix;
        currentValue = nextValue;
        return nextValue;
    }

    public List<ValueProducer> getProducerReferences() {
        return producerReferences;
    }

    public void setProducerReferences(List<ValueProducer> producerReferences) {
        this.producerReferences = producerReferences;
    }

    public String getInfix() {
        return infix;
    }

    public void setInfix(String infix) {
        this.infix = infix;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }
}
